package com.zte.stats.control;

import com.zte.stats.model.StatsCkWarehouse;
import com.zte.stats.model.StatsDeliveryCondition;
import com.zte.stats.model.StatsWarehouse;
import com.zte.stats.service.IStatsDeliveryService;
import com.zte.util.PageModel;
import com.zte.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/delivery")

public class StatsDeliveryAction {

    @Autowired
    private IStatsDeliveryService iStatsDeliveryService;

    @RequestMapping("/warehouse")
    @ResponseBody
    public ResultMessage queryWarehouseListByCondition(PageModel<StatsWarehouse<StatsCkWarehouse>> pageModel, StatsDeliveryCondition sdc) {
        PageModel<StatsWarehouse<StatsCkWarehouse>> statsWarehousePageModel = iStatsDeliveryService.queryWarehouseList(pageModel, sdc);
        ResultMessage msg = new ResultMessage();
        msg.setStatus(200);
        msg.setFlag(true);
        msg.setMsg("查询仓库成功！");
        msg.setData(statsWarehousePageModel);
        return msg;
    }

    @RequestMapping("/ckWarehouse")
    @ResponseBody
    public ResultMessage queryCkWarehouseListByCondition(PageModel<StatsCkWarehouse> pageModel, StatsDeliveryCondition sdc) {
        PageModel<StatsCkWarehouse> statsCkWarehousePageModel = iStatsDeliveryService.queryCKWarehouseList(pageModel, sdc);
        ResultMessage msg = new ResultMessage();
        msg.setStatus(200);
        msg.setFlag(true);
        msg.setMsg("查询仓库详情成功！");
        msg.setData(statsCkWarehousePageModel);
        return msg;
    }
}
